<!DOCTYPE html >
<html lang="en" xmlns:wb="http://open.weibo.com/wb">
<head>
    <meta charset="UTF-8">
    <meta property="wb:webmaster" content="3207af1dccc0fa8d" />
    <title>Title</title>
    <script src="http://tjs.sjs.sinajs.cn/open/api/js/wb.js?appkey=1091677952&debug=true" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<wb:login-button type="3,2" onlogin="login" onlogout="logout"></wb:login-button>
</body>

<script>
    WB2.logout(function() {
        alert("2")
    });
    WB2.login(function(){//登录授权
        WB2.anyWhere(function(W){
            alert(1)
            W.parseCMD('/account/get_uid.json',function(oResult1,bStatus){//获取用户uid
                alert(bStatus)
                if(bStatus){
                    W.parseCMD('/users/show.json',function(oResult2,bStatus){//通过uid获取用户信息
                        if(bStatus){
                            var args = {
                                openid:oResult2.id,//获取用户openid
                                access_token:WB2.oauthData.access_token,//获取用户access_token
                                username:oResult2.name,//获取用户名
                                userHeadImg:oResult2.profile_image_url,//获取用户微博头像
                            }
                            //然后根据实际情况进行自己网站的一些认证处理
                            alert(oResult2.name)
                        }
                    },{uid:oResult1.uid},{method:'get',cache_time:30});
                }
            },{},{method:'get',cache_time:30});//默认是post请求方法
        });
    });

</script>
</html>